package cn.xjt.service;

import cn.xjt.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * @author xu
 * @Description
 * @createTime 2021年03月04日 15:36:00
 */
//fallbackFactory           服务降级所执行的方法类，需要实现fallbackfactory
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientServerFailBackFactory.class)
@Component
public interface DeptClientServer {

    @GetMapping("/queryOne/{id}")
    public Dept getDept(@PathVariable("id") Long id);

    @GetMapping("/queryAll")
    public List<Dept> getAll();

    @PostMapping("/add")
    public Boolean addDept(Dept dept);
}
